package com.yonyou.brigade.openapi.controller;


import com.alibaba.fastjson.JSON;
import com.yonyou.brigade.facade.service.IApplyInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RequestMapping("/open/brigade/")
@Controller
public class ApplyInfoController {


    private Logger logger= LoggerFactory.getLogger(ApplyInfoController.class);

    @Autowired
    @Qualifier("applyInfoServiceImpl")
    private IApplyInfoService applyInfoService;


    @RequestMapping(value = "/addapply",method = RequestMethod.POST)
    public @ResponseBody
    String dealApply(@RequestBody Map applyInfoMap,HttpServletRequest request) throws Exception{
        logger.info("addapply interface params:" + JSON.toJSONString(applyInfoMap));
        String tenant=request.getParameter("tenantId");
        applyInfoService.dealApplyInfo(applyInfoMap,tenant);
        return  "success";
    }

    @RequestMapping(value = "/notes",method = RequestMethod.POST)
    public @ResponseBody
    String getNotesByApply(@RequestBody Map applyInfoMap,HttpServletRequest request) throws Exception{
        logger.info("notes interface params:"+ JSON.toJSONString(applyInfoMap));
        String tenant=request.getParameter("tenantId");
        applyInfoService.dealApplyInfo(applyInfoMap,tenant);
        return  "success";
    }

}
